<?php
//
//	file: includes/attach/class_attach.php
//	author: ptirhiik
//	begin: 05/03/2006
//	version: 1.6.4 - 02/12/2007
//	license: http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
//
//	based on : attachment_mod copyright (c) 2002 Meik Sievertsen (acydburn)
//

if ( !defined('IN_PHPBB') )
{
	die('Hacking attempt');
}

// global vars
$config->globals['mod_attachment_CH'] = array();
$config->globals['mod_attachment_CH']['config'] = false;
$config->globals['mod_attachment_CH']['extensions'] = false;

if ( !defined('ATTACH_CURRENT_VERSION') )
{
	// constants
	define('ATTACH_CURRENT_VERSION', '1.0.6');

	// Auth (only for auth.php, in order to be able to hit regen and get back this one)
	define('AUTH_DOWNLOAD', 20);

	// Download Modes
	define('INLINE_LINK', 1);
	define('PHYSICAL_LINK', 2);

	// Categories
	define('NONE_CAT', 0);
	define('IMAGE_CAT', 1);
	define('STREAM_CAT', 2);
	define('SWF_CAT', 3);
	define('DENIED_CAT', 4);

	// Tables
	define('ATT_CONFIG_TABLE', $table_prefix . 'att_config');
	define('ATT_EXT_GROUPS_TABLE', $table_prefix . 'att_ext_groups');
	define('ATT_EXTENSIONS_TABLE', $table_prefix . 'att_extensions');
	define('ATT_DESC_TABLE', $table_prefix . 'att_desc');
	define('ATT_LINKS_TABLE', $table_prefix . 'att_links');
	define('ATT_QUOTA_TABLE', $table_prefix . 'att_quota');
	define('ATT_QUOTA_LIMITS_TABLE', $table_prefix . 'att_quota_limits');
	define('ATT_TEMP_DIR_TABLE', $table_prefix . 'att_temp_dir');

	// Misc
	define('ADMIN_MAX_ATTACHMENTS', 50); // Maximum Attachments in Posts or PM's for Admin Users
	define('THUMB_DIR', 'thumbs');

	// Quota Types
	define('QUOTA_UPLOAD_LIMIT', 1);
	define('QUOTA_PM_LIMIT', 2);
}

// do not go further during login or installation
if ( defined('IN_LOGIN') || defined('IN_INSTALL') )
{
	return;
}

// intall directory still present
if ( file_exists(phpbb_realpath($config->root . 'install_att')) )
{
	if ( $config->data['mod_attachment_CH'] != ATTACH_CURRENT_VERSION )
	{
		header('Location: ' . $config->url('install_att/install'));
		exit;
	}
	else
	{
		message_die(GENERAL_MESSAGE, 'Please remove install_att/ directory');
	}
}

if ( $config->data['mod_attachment_CH'] )
{
	include($config->url('includes/attach/class_attach_init'));
}

?>